named route with parameter laravel

63

Route::get('/menu/{category}/{product}/{item}', ['as' => 'named.route' , 'uses' => 'MenuController@listItem']);

// to get the actual linke
route('named.route', ['category' => $category->id, 'product' => $product->id, 'item' => $item->id]);
Route::get('user/{id}', function ($id) {
    return 'User '.$id;
});
Route::get('/novanoticia', 'HomeController@getNovaNoticia')->name('route_name');
Route::get('/novanoticia', ['as' => 'route_name', 'uses' => 'HomeController@getNovaNoticia']);
Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
    //
});

Comments

Submit
0 Comments